#pragma once
#include "Runtime/CGI/DynamicCGI.h"
#include "CGIVulkanDevice.h"
#include "CGIVulkanViewport.h"
#include "Runtime/Utils/SmartPtr.h"

namespace Alice{
    struct CGIVulkanRHIExternalImageDeleteCallbackInfo
    {
        void* UserData;
        void (*Function)(void* UserData);
    };
    class CGIVulkan: public DynamicCGI{
    public:
        uint32 mAPIVersion;
        VkInstance mVkInstance;
        CGIVulkanDevice* mDevice;
        static CGIVulkan& Get(){ return *GetDynamicRHI<CGIVulkan>();}
        CGIVulkan();
        bool Init();
        SmartPtr<CGIViewport> CGICreateViewport(void* WindowHandle, uint32 SizeX, uint32 SizeY, bool bIsFullscreen, EPixelFormat PreferredPixelFormat);
        virtual SmartPtr<CGITexture> CGICreateTexture2DFromResource(EPixelFormat Format, uint32 SizeX, uint32 SizeY, uint32 NumMips, uint32 NumSamples, VkImage Resource, ETextureCreateFlags Flags,
            const FClearValueBinding& ClearValueBinding = FClearValueBinding::Transparent, const CGIVulkanRHIExternalImageDeleteCallbackInfo& ExternalImageDeleteCallbackInfo = {});
        SmartPtr<CGITexture> CGIGetViewportBackBuffer(CGIViewport* Viewport);
    };
}